<!DOCTYPE html>
<html lang="zh">

<head>
    <meta charset="UTF-8">
    <title>抱团</title>
    <meta name="viewport"
        content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no,minimal-ui,viewport-fit=cover" />
    <meta name="keywords" content="抱团">
    <meta name="description" content="抱团">
    <script type="text/javascript" src="js/base.js" charset="UTF-8"></script>
    <!-- <link rel="stylesheet" type="text/css" href="css/theme-chalk/index.css"> -->
    <!-- <link rel="stylesheet" type="text/css" href="css/swiper-bundle.min.css"> -->
    <link rel="stylesheet" type="text/css" href="css/base.css">
    <link rel="stylesheet" type="text/css" href="css/style.css">
    <script type='text/javascript' src="js/jquery.min.js" charset="UTF-8"></script>
    <!-- <script type='text/javascript' src="js/html2canvas.min.js" charset="UTF-8"></script> -->
    <script type="text/javascript" src="js/layer/layer.js" charset="UTF-8"></script>
    <script type="text/javascript" src="js/vue.js" charset="UTF-8"></script>
    <script type="text/javascript" src="js/axios.min.js" charset="UTF-8"></script>
    <!-- <script type='text/javascript' src="js/elementui.min.js" charset="UTF-8"></script> -->
    <!-- <script type='text/javascript' src="js/swiper-bundle.min.js" charset="UTF-8"></script> -->
    <script type='text/javascript' src="../common/js/helper.js" charset="UTF-8"></script>
</head>

<body>
    <div class="page mysy" id="app" v-if="loaded==true">
       <!-- 用户信息 -->
        <div class="user">
            <img class="img" :src="user_info.avatar_url" alt="">
            <div class="name">{{user_info.nickname}} 的金库</div>
        </div>
        <!-- 收益信息 -->
        <div class="syBox">
            <div class="top">
                <div class="text">我的总收益 : <span>{{shouyidata.total}}</span></div>
                <a href="./myTx.html" class="myjk">
                    <div class="icon"></div>
                    <div>立即提现</div>
                </a>
            </div>
            <div class="bottom">
                <div class="item">
                    <div class="t">未提现</div>
                    <div class="b">{{shouyidata.un_settled}}</div>
                </div>
                <div class="item">
                    <div class="t">已提现</div>
                    <div class="b">{{shouyidata.settled}}</div>
                </div>
                <div class="item">
                    <div class="t">直卖收益</div>
                    <div class="b">{{shouyidata.sale_profit}}</div>
                </div>
                <div class="item">
                    <div class="t">团队收益</div>
                    <div class="b">{{shouyidata.team_profit}}</div>
                </div>
            </div>
        </div>
        <!-- 收益详情 -->
        <div class="sylist">
            <div class="til">收益详情</div>
            <div class="jklist">
                <a href="./mysy.html?type=today" class="item">
                    <div class="one">今日收益： <span>{{listdata.today.profit_amount}}</span></div>
                    <div>今日订单： <span>{{listdata.today.order_count}}</span></div>
                </a>
                <a href="./mysy.html?type=yesterday" class="item">
                    <div class="one">昨日收益： <span>{{listdata.yesterday.profit_amount}}</span></div>
                    <div>昨日订单： <span>{{listdata.yesterday.order_count}}</span></div>
                </a>
                <a href="./mysy.html?type=week" class="item">
                    <div class="one">本周收益： <span>{{listdata.week.profit_amount}}</span></div>
                    <div>本周订单： <span>{{listdata.week.order_count}}</span></div>
                </a>
                <a href="./mysy.html?type=month" class="item">
                    <div class="one">本月收益： <span>{{listdata.month.profit_amount}}</span></div>
                    <div>本月订单： <span>{{listdata.month.order_count}}</span></div>
                </a>
                <a href="./mysy.html?type=all" class="item">
                    <div class="one">全部收益： <span>{{listdata.total.profit_amount}}</span></div>
                    <div>全部订单： <span>{{listdata.total.order_count}}</span></div>
                </a>
            </div>
        </div>    
    </div>

</body>
<script>
    new Vue({
        el: '#app',
        data() {
            return {
                user_info:{},
                loaded:false,
                shouyidata:'',
                listdata:'',
            }
        },
        mounted() {
            
            var that=this;
            var user_info=JSON.parse(getCookie("user_info"));
            if(!user_info){
                that.isLogin=false;
            }else{
                that.isLogin=true;
                that.user_info=user_info;
            }
            console.log(that.user_info)
            that.getdata();
        },
        methods: {
            getdata:function(){
                var that=this;
                var ready1=false,ready2=false;
                var load=setInterval(()=>{
                    if(ready1==true && ready2==true){
                        that.loaded=true;
                        clearInterval(load)
                    }
                },100)
                //查询收益概况
                talent_get('profits/total_summary').then(res => {
                    console.log(res);
                    that.shouyidata=res;
                    ready1=true;
                })
                //查询收益汇总
                talent_get('profits/detail_summary').then(res => {
                    console.log(res);
                    that.listdata=res;
                    ready2=true;
                })
            },
        }
    });
</script>

</html>